home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Packmags
/
NewsFlash - Issue 19 (1991-08)(UGA - NewsFlash UK)(Disk 1 of 2).zip
/
NewsFlash - Issue 19 (1991-08)(UGA - NewsFlash UK)(Disk 1 of 2).adf
/
sources
/
testbitsort.c
< prev
Wrap
C/C++ Source or Header
|
1978-01-06
|
902b
|
47 lines
/* BitSortTest.c */
#include <exec/types.h>
#include <exec/io.h>
#include <exec/memory.h>
#include <proto/exec.h>
#include <string.h>
#define TABLESIZE 10000
extern ULONG __regargs BitSortLongs (ULONG *, ULONG);
ULONG tablebit[TABLESIZE], tablequick[TABLESIZE];
main()
{
ULONG secs1, secs2;
int i;
for (i = 0; i < TABLESIZE; i++)
tablebit[i] = tablequick[i] = rand();
puts ("\nSorting 1000 random numbers:\n");
printf ("BitSort...");
time (&secs1);
BitSortLongs (tablebit, TABLESIZE);
time (&secs2);
printf ("%ld secs.\n\n", secs2 - secs1);
printf ("SAS/C QuickSort...");
time (&secs1);
lqsort (tablequick, TABLESIZE);
time (&secs2);
printf ("%ld secs.\n\n", secs2 - secs1);
puts ("Checking sorted arrays...");
for (i = 0; i < TABLESIZE; i++) {
if (tablebit[i] != tablequick[i]) {
/* Should NEVER happen !! */
puts ("Error!!!");
}
}
puts ("done.\n");
}